/*
  Copyright © 2014 Allen County Public Library.

  ACPL Mobile is free software: This program is distributed and you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.  ACPL Mobile is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, including without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ACPL Mobile. If not, see http://www.gnu.org/licenses/.
 * Author: James Harpe
 * 
 * 
 * Description: This class provides a simple representation of a locations distance from the user's current location.
 */

package us.in.lib.acpl.Mobile_ACPL.location;

public class LocationListItem implements Comparable<LocationListItem> {
	private String library;
	private double distanceFromCurrentLoc;

	public LocationListItem() {

	}

	public LocationListItem(String library, double distanceFromCurrentLoc) {
		this.library = library;
		this.distanceFromCurrentLoc = distanceFromCurrentLoc;
	}

	public String getLibrary() {
		return library;
	}

	public void setLibrary(String library) {
		this.library = library;
	}

	public double getDistanceFromCurrentLoc() {
		return distanceFromCurrentLoc;
	}

	public void setDistanceFromCurrentLoc(double distanceFromCurrentLoc) {
		this.distanceFromCurrentLoc = distanceFromCurrentLoc;
	}

	@Override
	public int compareTo(LocationListItem another) {
		if (this.distanceFromCurrentLoc < another.distanceFromCurrentLoc) {
			return -1;
		} else if (this.distanceFromCurrentLoc > another.distanceFromCurrentLoc) {
			return 1;
		} else {
			return 0;
		}
	}

}
